package com.example.demo.controller;

import com.example.demo.model.Book;
import com.example.demo.service.InterestingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 功能描述：
 *
 * @Author: Zhanghf
 * @Date: 2021/12/15 15:50
 */
@Controller
public class InterestingController {
    @Autowired
    private InterestingService interestingService;
    @GetMapping("/Content_based")
    public List<Book> Content_based(Integer userid)
    {
        return interestingService.Content_based(userid);
    }
    @GetMapping("/jkd_rec")
    public List<Map.Entry<Integer, Double>> jkd_rec(Integer recUserid)
    {

        return  interestingService.jkd_rec(recUserid);
    }
    @GetMapping("/pearson_rec")
    public List<Map.Entry<Integer, Double>> pearson_rec(Integer recUserid)
    {
        for (Map.Entry<Integer, Double> entry : interestingService.pearson_rec(recUserid)) {
            System.out.println(entry.getKey());
            System.out.println(entry.getValue());
        }
        return interestingService.pearson_rec(recUserid);
    }

}
